﻿#ifndef VIDEODECODE_H
#define VIDEODECODE_H

#include <QThread>
#include "videoConfig.h"

class videoDecode : public QThread
{
    Q_OBJECT
public:
    explicit videoDecode(QObject *parent);
    ~videoDecode();

    void decodeParamInit();
    void decodeParamDelete();
    int threadStartUp();
    int threadStop();
protected:
    void run();

    void sendPlayTime(quint64 playTime)
    {
        emit updatePlayTimeToPlayerSignal(playTime);
    }
    void sendImg(QImage img)
    {
        emit updatePlayImgToPlayerSignal(img);
    }
    ///////////////////////////////// 信号槽的定义 //////////////////////////////
public slots:

signals:
    void updatePlayTimeToPlayerSignal(quint64 playTime);
    void updatePlayImgToPlayerSignal(QImage img);

public://变量区

private:
    QString video_file;
    struct videoDecodeParam
    {
        AVFrame *RGB24_pFrame = Q_NULLPTR;
        AVFrame *SRC_VIDEO_pFrame= Q_NULLPTR;
        uint8_t *out_buffer_rgb= Q_NULLPTR;
        int numBytes;
        struct SwsContext *img_convert_ctx=Q_NULLPTR;  //用于解码后的视频格式转换
        DecodingRelated *Decoding;
        PlayRelated* UIPlay;
    }videoDecodeParam;
};

#endif // VIDEODECODE_H
